package net.j4love.protobuf;

import java.io.IOException;

/**
 * @author He Peng
 * @create 2018-05-12 23:52
 * @update 2018-05-12 23:52
 * @updatedesc : 更新说明
 * @see
 */
public class ProtobufCompilerUtils {

   public static void generateJavaCode(String protobufCompilerPath , String protoPath ,
                                       String codeDestPath , String ... protoFilePaths) {
        String protobufCmd = protobufCompilerPath + " -I=" + protoPath + " --java_out=" + codeDestPath + " ";
        for (String protoFilePath : protoFilePaths) {
            protobufCmd += " " + protoFilePath;
        }
        System.out.println("protobuf Generate Code Command : " + protobufCmd);
        try {
            Runtime.getRuntime().exec(protobufCmd);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
